package com.zw.yzk.kabu.mapper;

import com.zw.yzk.kabu.data.network.task.PublishCosTask;
import com.zw.yzk.kabu.model.PublishImageModel;

import java.util.ArrayList;
import java.util.List;

import javax.inject.Inject;

/**
 * Created by zhanwei on 2017/1/16.
 */

public class PublishMapper {

    @Inject
    public PublishMapper() {

    }

    public PublishCosTask.Item transfer(PublishImageModel model) {
        PublishCosTask.Item item = new PublishCosTask.Item();
        item.text = model.getRemark();
        item.imageUrl = model.getContentPath();

        return item;
    }

    public List<PublishCosTask.Item> transfer(List<PublishImageModel> modelList) {
        List<PublishCosTask.Item> itemList = new ArrayList<>();
        if (modelList == null || modelList.isEmpty()) {
            return itemList;
        }
            for (PublishImageModel model : modelList) {
                itemList.add(transfer(model));
            }
        return itemList;
    }
}
